package com.kerbores.blog.service.impl;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

import com.kerbores.blog.bean.Note;
import com.kerbores.blog.dao.INoteDao;
import com.kerbores.blog.service.INoteService;

/**
 * @author Ixion <br>
 *         create at 2014年11月3日
 */
@IocBean(name = "noteService")
public class NoteServiceImpl implements INoteService {

	@Inject
	private INoteDao noteDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.kerbores.blog.service.INoteService#save(com.kerbores.blog.bean.Note)
	 */
	@Override
	public boolean save(Note note) {
		return noteDao.save(note) != null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.kerbores.blog.service.INoteService#loadNew()
	 */
	@Override
	public List<Note> loadNew() {
		return noteDao.searchByPage(Cnd.orderBy().desc("id"), 1, 6);
	}
}
